﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using myNico.Mode;
using System.Xml.Serialization;
using System.IO;
namespace myNico.Dao
{
  public  class Dao_ViewModels
    {
       public static void SaveAsXmlFormat(List<ViewModels> obj, string filename)
       {
           XmlSerializer xml = new XmlSerializer(typeof(List<ViewModels>));
           using (Stream fs = new FileStream(filename,FileMode.Create))
           {
               xml.Serialize(fs, obj);
           }

       }

       public static List<ViewModels> LoadFromXml(string filename)
       {
           List<ViewModels> cf;
           XmlSerializer xm = new XmlSerializer(typeof(List<ViewModels>));
           using (Stream fs =  File.OpenRead(filename))
           {
                cf =(List<ViewModels>)xm.Deserialize(fs);
           }

          
           return cf;

         }
    }
    }

